package com.seecen.cywbackend.controller;

import com.seecen.cywbackend.service.FollowsService;
import com.seecen.cywbackend.utils.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/follows")
public class FollwsController {
    @Resource
    private FollowsService followsService;

    @PostMapping("/user")
    public Result followUser(@RequestParam Long targetId,
                             @RequestHeader String uid) {
        Long userId = Long.parseLong(uid);
        return followsService.followUser(targetId,userId );
    }

    @PostMapping("/group")
    public Result followGroup(
            @RequestParam Integer groupId,
            @RequestHeader String uid) {
        Long userId = Long.parseLong(uid);
        return followsService.followGroup(groupId, userId);
    }
}
